/*      */ package com.yc.dao;
/*      */ 
/*      */ import btsm.bean.dbConnector;
/*      */ import com.yc.dao.model.FiberInfoBO;
/*      */ import com.yc.dao.model.FiberLinkBO;
/*      */ import com.yc.dao.model.FiberUsedInfoBO;
/*      */ import com.yc.dao.model.FibercoreBO;
/*      */ import com.yc.dao.model.SectionInfoBo;
/*      */ import com.yc.dao.model.SectionOutInfoBO;
/*      */ import com.yc.util.ExtTreeNode;
/*      */ import com.yc.util.ListContentsBFO;
/*      */ import com.yc.web.FiberWeb;
/*      */ import java.sql.ResultSet;
/*      */ import java.text.SimpleDateFormat;
/*      */ import java.util.ArrayList;
/*      */ import java.util.Date;
/*      */ import java.util.HashMap;
/*      */ import java.util.List;
/*      */ import java.util.Map;
/*      */ import org.apache.commons.logging.Log;
/*      */ import org.apache.commons.logging.LogFactory;
/*      */ 
/*      */ public class FiberDAO
/*      */ {
/*   28 */   private static final Log log = LogFactory.getLog(FiberDAO.class);
/*      */ 
/*   30 */   private dbConnector dbcon = null;
/*   31 */   private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
/*      */ 
/*   33 */   private static Map countMap = new HashMap();
/*      */ 
/*      */   private void dbConInit() {
/*   36 */     if (this.dbcon == null)
/*   37 */       this.dbcon = new dbConnector();
/*      */   }
/*      */ 
/*      */   public void dbConClose() {
/*   41 */     if (this.dbcon != null)
/*   42 */       this.dbcon.closeAll();
/*   43 */     this.dbcon = null;
/*      */   }
/*      */ 
/*      */   public ListContentsBFO getFiblerLinkList(Map condition) {
/*   47 */     log.info(" query fiber link .");
/*   48 */     dbConInit();
/*   49 */     ListContentsBFO bfo = new ListContentsBFO();
/*   50 */     int start = Integer.parseInt(condition.get("start").toString());
/*   51 */     int limit = Integer.parseInt(condition.get("limit").toString());
/*   52 */     Object queryObj = condition.get("query");
/*      */ 
/*   54 */     ResultSet rs = null;
/*   55 */     List fileList = new ArrayList();
/*      */     try
/*      */     {
/*      */       String strSQL;
/*   58 */       if ((queryObj == null) || ("".equalsIgnoreCase(queryObj.toString().trim()))) {
/*   59 */         strSQL = "select count(id) from fiberlink";
/*      */       }
/*      */       else {
/*   62 */         strSQL = "select count(id) from fiberlink where  binary ucase(linkName) like concat('%',ucase('" + queryObj.toString() + "'),'%')";
/*      */       }
/*      */ 
/*   65 */       log.info(strSQL);
/*   66 */       rs = this.dbcon.execQuery(strSQL);
/*   67 */       if (rs.next()) {
/*   68 */         bfo.setTotalSize(rs.getInt(1));
/*      */       }
/*   70 */       if ((queryObj == null) || ("".equalsIgnoreCase(queryObj.toString().trim())))
/*   71 */         strSQL = "select * from fiberlink order by createTime desc limit " + start + ", " + limit;
/*      */       else {
/*   73 */         strSQL = "select * from fiberlink where  binary ucase(linkName) like concat('%',ucase('" + queryObj.toString() + "'),'%') order by createTime desc limit " + start + ", " + limit;
/*      */       }
/*   75 */       log.info(strSQL);
/*   76 */       rs = this.dbcon.execQuery(strSQL);
/*   77 */       while (rs.next()) {
/*   78 */         FiberLinkBO bo = new FiberLinkBO();
/*   79 */         bo.setId(rs.getString("id"));
/*   80 */         bo.setStrFiberLinkName(rs.getString("linkName"));
/*   81 */         bo.setCreateTime(rs.getString("createTime"));
/*   82 */         bo.setUpdateTime(rs.getString("updateTime"));
/*   83 */         fileList.add(bo);
/*      */       }
/*   85 */       bfo.setData(fileList.toArray());
/*      */     } catch (Exception e) {
/*   87 */       e.printStackTrace();
/*   88 */       log.error("query file failed .");
/*      */     } finally {
/*   90 */       dbConClose();
/*      */     }
/*   92 */     return bfo;
/*      */   }
/*      */ 
/*      */   public ListContentsBFO getFiblerLinkListForBrowse(Map condition) {
/*   96 */     log.info(" query fiber link .");
/*   97 */     dbConInit();
/*   98 */     ListContentsBFO bfo = new ListContentsBFO();
/*   99 */     int start = Integer.parseInt(condition.get("start").toString());
/*  100 */     int limit = Integer.parseInt(condition.get("limit").toString());
/*  101 */     Object queryObj = condition.get("query");
/*      */ 
/*  103 */     ResultSet rs = null;
/*  104 */     List fileList = new ArrayList();
/*      */     try
/*      */     {
/*      */       String strSQL;
/*  107 */       if ((queryObj == null) || ("".equalsIgnoreCase(queryObj.toString().trim()))) {
/*  108 */         strSQL = "select count(id) from fiberlink";
/*      */       }
/*      */       else {
/*  111 */         strSQL = "select count(id) from fiberlink where  binary ucase(linkName) like concat('%',ucase('" + queryObj.toString() + "'),'%')";
/*      */       }
/*      */ 
/*  114 */       log.info(strSQL);
/*  115 */       rs = this.dbcon.execQuery(strSQL);
/*  116 */       if (rs.next()) {
/*  117 */         bfo.setTotalSize(rs.getInt(1));
/*      */       }
/*  119 */       if ((queryObj == null) || ("".equalsIgnoreCase(queryObj.toString().trim())))
/*  120 */         strSQL = "select * from fiberlink order by createTime desc limit " + start + ", " + limit;
/*      */       else {
/*  122 */         strSQL = "select * from fiberlink where  binary ucase(linkName) like concat('%',ucase('" + queryObj.toString() + "'),'%') order by createTime desc limit " + start + ", " + limit;
/*      */       }
/*  124 */       log.info(strSQL);
/*  125 */       rs = this.dbcon.execQuery(strSQL);
/*  126 */       while (rs.next()) {
/*  127 */         FiberLinkBO bo = new FiberLinkBO();
/*  128 */         bo.setId(rs.getString("id"));
/*  129 */         bo.setStrFiberLinkName(rs.getString("linkName"));
/*  130 */         bo.setCreateTime(rs.getString("createTime"));
/*  131 */         bo.setUpdateTime(rs.getString("updateTime"));
/*  132 */         fileList.add(bo);
/*      */       }
/*  134 */       bfo.setData(fileList.toArray());
/*      */     } catch (Exception e) {
/*  136 */       e.printStackTrace();
/*  137 */       log.error("query file failed .");
/*      */     } finally {
/*  139 */       dbConClose();
/*      */     }
/*  141 */     return bfo;
/*      */   }
/*      */ 
/*      */   public Map getSectionByIdOrOther(String strID) {
/*  145 */     Map map = new HashMap();
/*  146 */     ResultSet rs = null;
/*      */     try {
/*  148 */       dbConInit();
/*  149 */       String strSQL = "select * from sectiontotalinfo where linkID = '" + 
/*  150 */         strID + "' ";
/*      */ 
/*  152 */       log.info(strSQL);
/*  153 */       rs = this.dbcon.execQuery(strSQL);
/*  154 */       while (rs.next())
/*  155 */         map.put(rs.getString("OcID"), rs.getString("OcName"));
/*      */     }
/*      */     catch (Exception e) {
/*  158 */       e.printStackTrace();
/*  159 */       log.error("query fiber section failed .");
/*      */     } finally {
/*  161 */       dbConClose();
/*      */     }
/*  163 */     return map;
/*      */   }
/*      */ 
/*      */   public ListContentsBFO getSectionInfoList(Map condition) {
/*  167 */     log.info(" query section info by id .");
/*  168 */     dbConInit();
/*  169 */     ListContentsBFO bfo = new ListContentsBFO();
/*  170 */     String strLinkID = null;
/*  171 */     if ((condition.containsKey("id")) && (condition.get("id") != null))
/*  172 */       strLinkID = condition.get("id").toString();
/*  173 */     int start = Integer.parseInt(condition.get("start").toString());
/*  174 */     int limit = Integer.parseInt(condition.get("limit").toString());
/*  175 */     String strUserId = condition.get("USER_ID").toString();
/*  176 */     String strUserRoleName = condition.get("USER_ROLE").toString();
/*  177 */     Object queryObj = condition.get("query");
/*  178 */     ResultSet rs = null;
/*  179 */     List fileList = new ArrayList();
/*      */     try {
/*  181 */       String strSQL = "";
/*  182 */       if ((queryObj == null) || ("".equalsIgnoreCase(queryObj.toString().trim())))
/*      */       {
/*  184 */         if (strLinkID != null) {
/*  185 */           if ("admin".equals(strUserRoleName))
/*  186 */             strSQL = "select count(ocid) from sectiontotalinfo where linkID = '" + strLinkID + "'";
/*      */           else
/*  188 */             strSQL = "select count(ocid) from sectiontotalinfo where linkID = '" + strLinkID + "' and userid = '" + strUserId + "'";
/*      */         }
/*  190 */         else if ("admin".equals(strUserRoleName))
/*  191 */           strSQL = "select count(OcID) from sectiontotalinfo ";
/*      */         else {
/*  193 */           strSQL = "select count(OcID) from sectiontotalinfo where userid = '" + strUserId + "'";
/*      */         }
/*      */ 
/*      */       }
/*  198 */       else if (strLinkID != null) {
/*  199 */         if ("admin".equals(strUserRoleName))
/*  200 */           strSQL = "select count(ocid) from sectiontotalinfo where linkID = '" + strLinkID + "' " + 
/*  201 */             " and ( binary ucase(ocBeginName) like concat('%',ucase('" + queryObj.toString() + "'),'%') " + 
/*  202 */             " or binary ucase(ocEndName) like concat('%',ucase('" + queryObj.toString() + "'),'%'))";
/*      */         else
/*  204 */           strSQL = "select count(ocid) from sectiontotalinfo where linkID = '" + strLinkID + "' and userid = '" + strUserId + "' " + 
/*  205 */             " and ( binary ucase(ocBeginName) like concat('%',ucase('" + queryObj.toString() + "'),'%') " + 
/*  206 */             " or binary ucase(ocEndName) like concat('%',ucase('" + queryObj.toString() + "'),'%'))";
/*      */       }
/*  208 */       else if ("admin".equals(strUserRoleName))
/*  209 */         strSQL = "select count(OcID) from sectiontotalinfo where  binary ucase(ocBeginName) like concat('%',ucase('" + 
/*  210 */           queryObj.toString() + "'),'%') " + 
/*  211 */           " or binary ucase(ocEndName) like concat('%',ucase('" + queryObj.toString() + "'),'%')";
/*      */       else {
/*  213 */         strSQL = "select count(OcID) from sectiontotalinfo where  userid = '" + strUserId + "' and (" + 
/*  214 */           "  binary ucase(ocBeginName) like concat('%',ucase('" + queryObj.toString() + "'),'%') " + 
/*  215 */           " or binary ucase(ocEndName) like concat('%',ucase('" + queryObj.toString() + "'),'%') )";
/*      */       }
/*      */ 
/*  219 */       log.info(strSQL);
/*  220 */       rs = this.dbcon.execQuery(strSQL);
/*  221 */       if (rs.next()) {
/*  222 */         bfo.setTotalSize(rs.getInt(1));
/*      */       }
/*  224 */       if ((queryObj == null) || ("".equalsIgnoreCase(queryObj.toString().trim())))
/*      */       {
/*  226 */         if (strLinkID != null) {
/*  227 */           if ("admin".equals(strUserRoleName))
/*  228 */             strSQL = "select * from sectiontotalinfo where OcID in( select t.ocid from ( select * from fiberlinkandsection where  linkID = '" + strLinkID + "' limit " + start + ", " + limit + " )as t )  order by refreshtime desc";
/*      */           else
/*  230 */             strSQL = "select * from sectiontotalinfo where OcID in( select t.ocid from ( select * from fiberlinkandsection where  linkID = '" + strLinkID + "' limit " + start + ", " + limit + " )as t ) and userid = '" + strUserId + "'  order by refreshtime desc";
/*      */         }
/*  232 */         else if ("admin".equals(strUserRoleName))
/*  233 */           strSQL = "select * from sectiontotalinfo order by refreshtime desc limit " + start + ", " + limit;
/*      */         else
/*  235 */           strSQL = "select * from sectiontotalinfo where userid = '" + strUserId + "' order by refreshtime desc limit " + start + ", " + limit;
/*      */       }
/*  237 */       else if (strLinkID != null) {
/*  238 */         if ("admin".equals(strUserRoleName))
/*  239 */           strSQL = "select * from sectiontotalinfo where OcID in( select t.ocid from ( select * from fiberlinkandsection where  linkID = '" + strLinkID + "'" + 
/*  240 */             " and ( binary ucase(ocBeginName) like concat('%',ucase('" + queryObj.toString() + "'),'%') " + 
/*  241 */             " or binary ucase(ocEndName) like concat('%',ucase('" + queryObj.toString() + "'),'%') )" + 
/*  242 */             " limit " + start + ", " + limit + " )as t )  order by refreshtime desc ";
/*      */         else {
/*  244 */           strSQL = "select * from sectiontotalinfo where OcID in( select t.ocid from ( select * from fiberlinkandsection where  linkID = '" + strLinkID + "'" + 
/*  245 */             " and ( binary ucase(ocBeginName) like concat('%',ucase('" + queryObj.toString() + "'),'%') " + 
/*  246 */             " or binary ucase(ocEndName) like concat('%',ucase('" + queryObj.toString() + "'),'%') )" + 
/*  247 */             " limit " + start + ", " + limit + " )as t ) and userid = '" + strUserId + "'  order by refreshtime desc ";
/*      */         }
/*      */       }
/*  250 */       else if ("admin".equals(strUserRoleName))
/*  251 */         strSQL = "select * from sectiontotalinfo where  binary ucase(ocBeginName) like concat('%',ucase('" + 
/*  252 */           queryObj.toString() + "'),'%') " + 
/*  253 */           " or binary ucase(ocEndName) like concat('%',ucase('" + queryObj.toString() + "'),'%') " + 
/*  254 */           " order by refreshtime desc limit " + start + ", " + limit;
/*      */       else {
/*  256 */         strSQL = "select * from sectiontotalinfo where userid = '" + strUserId + "' and (" + 
/*  257 */           "  binary ucase(ocBeginName) like concat('%',ucase('" + queryObj.toString() + "'),'%') " + 
/*  258 */           " or binary ucase(ocEndName) like concat('%',ucase('" + queryObj.toString() + "'),'%') ) " + 
/*  259 */           " order by refreshtime desc limit " + start + ", " + limit;
/*      */       }
/*      */ 
/*  263 */       log.info(strSQL);
/*  264 */       rs = this.dbcon.execQuery(strSQL);
/*  265 */       while (rs.next()) {
/*  266 */         SectionInfoBo bo = new SectionInfoBo();
/*  267 */         bo.setId(rs.getString("OcID"));
/*  268 */         bo.setOcID(rs.getString("OcID"));
/*  269 */         bo.setLinkID(rs.getString("linkID"));
/*  270 */         bo.setOcName(rs.getString("OcName"));
/*  271 */         bo.setOcBeginName(rs.getString("ocBeginName"));
/*  272 */         bo.setOcBeginLng(rs.getString("ocBeginLng"));
/*  273 */         bo.setOcBeginLat(rs.getString("ocBeginLat"));
/*  274 */         bo.setOcEndName(rs.getString("ocEndName"));
/*  275 */         bo.setOcEndLng(rs.getString("ocEndLng"));
/*  276 */         bo.setOcEndLat(rs.getString("ocEndLat"));
/*  277 */         bo.setOcType(rs.getString("ocType"));
/*  278 */         bo.setOcNum(rs.getString("ocNum"));
/*  279 */         bo.setOcLength(rs.getString("ocLength"));
/*  280 */         bo.setOcInspectorName(rs.getString("ocInspectorName"));
/*  281 */         bo.setOcInspectorPhone(rs.getString("ocInspectorPhone"));
/*  282 */         bo.setNotes(rs.getString("notes"));
/*  283 */         if ("admin".equals(strUserRoleName)) {
/*  284 */           bo.setCanEdit("EDIT_YES");
/*      */         }
/*  286 */         else if (strUserId.equals(rs.getString("userid")))
/*      */         {
/*  289 */           bo.setCanEdit("EDIT_YES");
/*      */         }
/*      */         else {
/*  292 */           bo.setCanEdit("EDIT_NO");
/*      */         }
/*      */ 
/*  297 */         fileList.add(bo);
/*      */       }
/*  299 */       bfo.setData(fileList.toArray());
/*      */     } catch (Exception e) {
/*  301 */       e.printStackTrace();
/*  302 */       log.error("query fiber section failed .");
/*      */     } finally {
/*  304 */       dbConClose();
/*      */     }
/*  306 */     return bfo;
/*      */   }
/*      */ 
/*      */   public ListContentsBFO getSectionInfoListForBrowse(Map condition)
/*      */   {
/*  311 */     log.info(" query section info by id .");
/*  312 */     dbConInit();
/*  313 */     ListContentsBFO bfo = new ListContentsBFO();
/*  314 */     String strLinkID = null;
/*  315 */     if ((condition.containsKey("id")) && (condition.get("id") != null))
/*  316 */       strLinkID = condition.get("id").toString();
/*  317 */     int start = Integer.parseInt(condition.get("start").toString());
/*  318 */     int limit = Integer.parseInt(condition.get("limit").toString());
/*  319 */     String strUserId = condition.get("USER_ID").toString();
/*  320 */     String strUserRoleName = condition.get("USER_ROLE").toString();
/*  321 */     Object queryObj = condition.get("query");
/*  322 */     ResultSet rs = null;
/*  323 */     List fileList = new ArrayList();
/*      */     try {
/*  325 */       String strSQL = "";
/*  326 */       if ((queryObj == null) || ("".equalsIgnoreCase(queryObj.toString().trim())))
/*      */       {
/*  328 */         if (strLinkID != null)
/*  329 */           strSQL = "select count(ocid) from sectiontotalinfo where linkID = '" + strLinkID + "'";
/*      */         else {
/*  331 */           strSQL = "select count(OcID) from sectiontotalinfo ";
/*      */         }
/*      */ 
/*      */       }
/*  336 */       else if (strLinkID != null) {
/*  337 */         strSQL = "select count(ocid) from sectiontotalinfo where linkID = '" + strLinkID + "' " + 
/*  338 */           " and ( binary ucase(ocBeginName) like concat('%',ucase('" + queryObj.toString() + "'),'%') " + 
/*  339 */           " or binary ucase(ocEndName) like concat('%',ucase('" + queryObj.toString() + "'),'%'))";
/*      */       }
/*      */       else {
/*  342 */         strSQL = "select count(OcID) from sectiontotalinfo where  binary ucase(ocBeginName) like concat('%',ucase('" + 
/*  343 */           queryObj.toString() + "'),'%') " + 
/*  344 */           " or binary ucase(ocEndName) like concat('%',ucase('" + queryObj.toString() + "'),'%')";
/*      */       }
/*      */ 
/*  349 */       log.info(strSQL);
/*  350 */       rs = this.dbcon.execQuery(strSQL);
/*  351 */       if (rs.next()) {
/*  352 */         bfo.setTotalSize(rs.getInt(1));
/*      */       }
/*  354 */       if ((queryObj == null) || ("".equalsIgnoreCase(queryObj.toString().trim())))
/*      */       {
/*  356 */         if (strLinkID != null) {
/*  357 */           strSQL = "select * from sectiontotalinfo where OcID in( select t.ocid from ( select * from fiberlinkandsection where  linkID = '" + strLinkID + "' limit " + start + ", " + limit + " )as t )  order by refreshtime desc";
/*      */         }
/*      */         else {
/*  360 */           strSQL = "select * from sectiontotalinfo order by refreshtime desc limit " + start + ", " + limit;
/*      */         }
/*      */       }
/*  363 */       else if (strLinkID != null) {
/*  364 */         strSQL = "select * from sectiontotalinfo where OcID in( select t.ocid from ( select * from fiberlinkandsection where  linkID = '" + strLinkID + "'" + 
/*  365 */           " and ( binary ucase(ocBeginName) like concat('%',ucase('" + queryObj.toString() + "'),'%') " + 
/*  366 */           " or binary ucase(ocEndName) like concat('%',ucase('" + queryObj.toString() + "'),'%') )" + 
/*  367 */           " limit " + start + ", " + limit + " )as t )  order by refreshtime desc ";
/*      */       }
/*      */       else {
/*  370 */         strSQL = "select * from sectiontotalinfo where  binary ucase(ocBeginName) like concat('%',ucase('" + 
/*  371 */           queryObj.toString() + "'),'%') " + 
/*  372 */           " or binary ucase(ocEndName) like concat('%',ucase('" + queryObj.toString() + "'),'%') " + 
/*  373 */           " order by refreshtime desc limit " + start + ", " + limit;
/*      */       }
/*      */ 
/*  378 */       log.info(strSQL);
/*  379 */       rs = this.dbcon.execQuery(strSQL);
/*  380 */       while (rs.next()) {
/*  381 */         SectionInfoBo bo = new SectionInfoBo();
/*  382 */         bo.setId(rs.getString("OcID"));
/*  383 */         bo.setOcID(rs.getString("OcID"));
/*  384 */         bo.setLinkID(rs.getString("linkID"));
/*  385 */         bo.setOcName(rs.getString("OcName"));
/*  386 */         bo.setOcBeginName(rs.getString("ocBeginName"));
/*  387 */         bo.setOcBeginLng(rs.getString("ocBeginLng"));
/*  388 */         bo.setOcBeginLat(rs.getString("ocBeginLat"));
/*  389 */         bo.setOcEndName(rs.getString("ocEndName"));
/*  390 */         bo.setOcEndLng(rs.getString("ocEndLng"));
/*  391 */         bo.setOcEndLat(rs.getString("ocEndLat"));
/*  392 */         bo.setOcType(rs.getString("ocType"));
/*  393 */         bo.setOcNum(rs.getString("ocNum"));
/*  394 */         bo.setOcLength(rs.getString("ocLength"));
/*  395 */         bo.setOcInspectorName(rs.getString("ocInspectorName"));
/*  396 */         bo.setOcInspectorPhone(rs.getString("ocInspectorPhone"));
/*  397 */         bo.setNotes(rs.getString("notes"));
/*  398 */         bo.setCanEdit("EDIT_YES");
/*      */ 
/*  400 */         fileList.add(bo);
/*      */       }
/*  402 */       bfo.setData(fileList.toArray());
/*      */     } catch (Exception e) {
/*  404 */       e.printStackTrace();
/*  405 */       log.error("query fiber section failed .");
/*      */     } finally {
/*  407 */       dbConClose();
/*      */     }
/*  409 */     return bfo;
/*      */   }
/*      */ 
/*      */   public ListContentsBFO getOtherSectionInfoList(Map condition)
/*      */   {
/*  415 */     log.info(" query section info by id .");
/*  416 */     dbConInit();
/*  417 */     ListContentsBFO bfo = new ListContentsBFO();
/*  418 */     String strLinkID = condition.get("id").toString();
/*  419 */     int start = Integer.parseInt(condition.get("start").toString());
/*  420 */     int limit = Integer.parseInt(condition.get("limit").toString());
/*  421 */     String strUserId = condition.get("USER_ID").toString();
/*  422 */     String strUserRoleName = condition.get("USER_ROLE").toString();
/*  423 */     ResultSet rs = null;
/*  424 */     List fileList = new ArrayList();
/*      */     try {
/*  426 */       String strSQL = "select count(OcID) from sectiontotalinfo where OcID not in( select t.ocid from ( select * from fiberlinkandsection where linkID = '" + strLinkID + "' )as t) ";
/*      */ 
/*  428 */       log.info(strSQL);
/*  429 */       rs = this.dbcon.execQuery(strSQL);
/*  430 */       if (rs.next()) {
/*  431 */         bfo.setTotalSize(rs.getInt(1));
/*      */       }
/*  433 */       strSQL = "select * from sectiontotalinfo where OcID not in ( select t.ocid from (select * from fiberlinkandsection where linkID = '" + strLinkID + "' limit " + start + ", " + limit + ")as t)";
/*      */ 
/*  435 */       log.info(strSQL);
/*  436 */       rs = this.dbcon.execQuery(strSQL);
/*  437 */       while (rs.next()) {
/*  438 */         SectionInfoBo bo = new SectionInfoBo();
/*  439 */         bo.setId(rs.getString("OcID"));
/*  440 */         bo.setOcID(rs.getString("OcID"));
/*  441 */         bo.setOcName(rs.getString("OcName"));
/*  442 */         bo.setOcBeginName(rs.getString("ocBeginName"));
/*  443 */         bo.setOcBeginLng(rs.getString("ocBeginLng"));
/*  444 */         bo.setOcBeginLat(rs.getString("ocBeginLat"));
/*  445 */         bo.setOcEndName(rs.getString("ocEndName"));
/*  446 */         bo.setOcEndLng(rs.getString("ocEndLng"));
/*  447 */         bo.setOcEndLat(rs.getString("ocEndLat"));
/*  448 */         if ("admin".equals(strUserRoleName)) {
/*  449 */           bo.setCanEdit("EDIT_YES");
/*      */         }
/*  451 */         else if (strUserId.equals(rs.getString("userid")))
/*      */         {
/*  454 */           bo.setCanEdit("EDIT_YES");
/*      */         }
/*      */         else {
/*  457 */           bo.setCanEdit("EDIT_NO");
/*      */         }
/*      */ 
/*  461 */         fileList.add(bo);
/*      */       }
/*      */ 
/*  464 */       bfo.setData(fileList.toArray());
/*      */     } catch (Exception e) {
/*  466 */       e.printStackTrace();
/*  467 */       log.error("query fiber section failed .");
/*      */     } finally {
/*  469 */       dbConClose();
/*      */     }
/*  471 */     return bfo;
/*      */   }
/*      */ 
/*      */   public boolean createFiberLink(FiberLinkBO bo) {
/*  475 */     boolean flag = true;
/*      */     try {
/*  477 */       dbConInit();
/*  478 */       String strSQL = "insert into fiberlink (id,linkName,createTime) values ( '" + 
/*  479 */         bo.getId() + 
/*  480 */         "' , '" + 
/*  481 */         bo.getStrFiberLinkName() + 
/*  482 */         "', '" + 
/*  483 */         this.sdf.format(new Date()) + "')";
/*  484 */       log.info(strSQL);
/*  485 */       this.dbcon.execUpdate(strSQL);
/*      */     } catch (Exception e) {
/*  487 */       flag = false;
/*  488 */       e.printStackTrace();
/*  489 */       log.error(e.getMessage());
/*  490 */       log.error("save fiber link failure ");
/*      */     } finally {
/*  492 */       dbConClose();
/*      */     }
/*  494 */     return flag;
/*      */   }
/*      */ 
/*      */   public boolean updateFiberLink(FiberLinkBO bo) {
/*  498 */     boolean flag = true;
/*      */     try {
/*  500 */       dbConInit();
/*  501 */       String strSQL = "update fiberlink set linkName = '" + 
/*  502 */         bo.getStrFiberLinkName() + "',updateTime = '" + 
/*  503 */         this.sdf.format(new Date()) + "'  where id = '" + bo.getId() + 
/*  504 */         "' ";
/*  505 */       log.info(strSQL);
/*  506 */       this.dbcon.execUpdate(strSQL);
/*      */     } catch (Exception e) {
/*  508 */       flag = false;
/*  509 */       e.printStackTrace();
/*  510 */       log.error(e.getMessage());
/*  511 */       log.error("update fiber link failure ");
/*      */     } finally {
/*  513 */       dbConClose();
/*      */     }
/*  515 */     return flag;
/*      */   }
/*      */ 
/*      */   public boolean deleteFiberLink(String id) {
/*  519 */     boolean flag = true;
/*      */     try {
/*  521 */       dbConInit();
/*  522 */       String strSQL = "delete from fiberlink  where id = '" + id + "' ";
/*  523 */       log.info(strSQL);
/*  524 */       this.dbcon.execUpdate(strSQL);
/*  525 */       strSQL = "delete from fiberlinkandsection  where linkID = '" + id + "' ";
/*  526 */       log.info(strSQL);
/*  527 */       this.dbcon.execUpdate(strSQL);
/*      */     } catch (Exception e) {
/*  529 */       flag = false;
/*  530 */       e.printStackTrace();
/*  531 */       log.error(e.getMessage());
/*  532 */       log.error("delete fiber link failure ");
/*      */     } finally {
/*  534 */       dbConClose();
/*      */     }
/*  536 */     return flag;
/*      */   }
/*      */ 
/*      */   private String getQuery(String strDjJc) {
/*  540 */     String strQueryMaxSQL = "";
/*  541 */     if (FiberWeb.LINK.equalsIgnoreCase(strDjJc))
/*  542 */       strQueryMaxSQL = "select max(id) as strMaxNo from  fiberlink where id like '";
/*  543 */     else if (FiberWeb.SECTION.equalsIgnoreCase(strDjJc))
/*  544 */       strQueryMaxSQL = "select max(OcID) as strMaxNo from  sectiontotalinfo where OcID like '";
/*  545 */     else if (FiberWeb.SECTION_OUT.equalsIgnoreCase(strDjJc))
/*  546 */       strQueryMaxSQL = "select max(id) as strMaxNo from  sectionoutinfo where id like '";
/*  547 */     else if (FiberWeb.FIBER_INFO.equalsIgnoreCase(strDjJc))
/*  548 */       strQueryMaxSQL = "select max(fiberid) as strMaxNo from  fiberinfo where fiberid like '";
/*  549 */     else if (FiberWeb.FIBER_USED_INFO.equalsIgnoreCase(strDjJc))
/*  550 */       strQueryMaxSQL = "select max(id) as strMaxNo from  fiberusedinfo where id like '";
/*  551 */     else if (FiberWeb.FIBER_CORE.equalsIgnoreCase(strDjJc))
/*  552 */       strQueryMaxSQL = "select max(id) as strMaxNo from  fibercore where id like '";
/*      */     else
/*  554 */       strQueryMaxSQL = "select max(id) as strMaxNo from  fiberlink where id like '";
/*  555 */     return strQueryMaxSQL;
/*      */   }
/*      */ 
/*      */   public String queryMaxID(String strDjJc)
/*      */   {
/*  565 */     dbConInit();
/*  566 */     ResultSet rs = null;
/*  567 */     String strQueryMaxSQLWhere = "";
/*  568 */     String strQueryMaxSQL = "";
/*  569 */     String strMaxNo = "";
/*  570 */     String strMatch = "";
/*      */ 
/*  572 */     long lLshCd = 4L;
/*      */     try
/*      */     {
/*  575 */       for (int i = 0; i < lLshCd; i++) {
/*  576 */         strMatch = strMatch + "_";
/*      */       }
/*      */ 
/*  579 */       Date nowTime = new Date();
/*  580 */       SimpleDateFormat fmtDate = null;
/*  581 */       fmtDate = new SimpleDateFormat("yyyyMMdd");
/*  582 */       String strDate = fmtDate.format(nowTime);
/*  583 */       strQueryMaxSQLWhere = strDjJc + strDate;
/*  584 */       strQueryMaxSQL = getQuery(strDjJc) + strQueryMaxSQLWhere + strMatch + 
/*  585 */         "' ";
/*      */ 
/*  587 */       strQueryMaxSQL = new String(strQueryMaxSQL.getBytes("ISO8859-1"), 
/*  588 */         "UTF-8");
/*  589 */       log.debug("strQueryMaxSQL = [" + strQueryMaxSQL + "]");
/*  590 */       rs = this.dbcon.execQuery(strQueryMaxSQL);
/*  591 */       if (rs.next()) {
/*  592 */         strMaxNo = rs.getString("strMaxNo");
/*      */       }
/*  594 */       if (rs != null) {
/*  595 */         rs.close();
/*  596 */         rs = null;
/*      */       }
/*      */ 
/*  600 */       if ((strMaxNo == null) || 
/*  601 */         (strMaxNo.equals("")) || 
/*  602 */         (strMaxNo.length() != strQueryMaxSQLWhere.length() + lLshCd)) {
/*  603 */         for (int i = 1; i < lLshCd; i++) {
/*  604 */           strQueryMaxSQLWhere = strQueryMaxSQLWhere + "0";
/*      */         }
/*  606 */         strMaxNo = strQueryMaxSQLWhere + "1";
/*  607 */         log.debug("是第一个编号=" + strMaxNo);
/*      */       }
/*      */       else
/*      */       {
/*  612 */         long lLshValue = Long.valueOf(
/*  613 */           strMaxNo.substring((int)(strMaxNo.length() - lLshCd), 
/*  614 */           strMaxNo.length())).longValue() + 1L;
/*      */ 
/*  616 */         String strLshBh = String.valueOf(lLshValue);
/*      */ 
/*  618 */         for (int i = strLshBh.length(); i < lLshCd; i++) {
/*  619 */           strLshBh = "0" + strLshBh;
/*      */         }
/*  621 */         strMaxNo = strQueryMaxSQLWhere + strLshBh;
/*  622 */         log.debug("如果不是第一个编号=" + strMaxNo);
/*      */       }
/*      */     } catch (Exception e) {
/*  625 */       e.printStackTrace();
/*      */       try
/*      */       {
/*  628 */         if (rs != null) {
/*  629 */           rs.close();
/*  630 */           rs = null;
/*      */         }
/*      */       } catch (Exception ex) {
/*  633 */         ex.printStackTrace();
/*      */       }
/*      */     }
/*      */     finally
/*      */     {
/*      */       try
/*      */       {
/*  628 */         if (rs != null) {
/*  629 */           rs.close();
/*  630 */           rs = null;
/*      */         }
/*      */       } catch (Exception ex) {
/*  633 */         ex.printStackTrace();
/*      */       }
/*      */     }
/*  636 */     dbConClose();
/*  637 */     return strMaxNo;
/*      */   }
/*      */ 
/*      */   public List getFiblerAndSectionList(String strId) {
/*  641 */     log.info(" query fiber and section link .");
/*  642 */     dbConInit();
/*      */ 
/*  644 */     ResultSet rs = null;
/*  645 */     List fileList = new ArrayList();
/*      */     try {
/*  647 */       String strSQL = "select * from fiberlinksection where id = '" + 
/*  648 */         strId + "' ";
/*      */ 
/*  650 */       log.info(strSQL);
/*  651 */       rs = this.dbcon.execQuery(strSQL);
/*  652 */       while (rs.next()) {
/*  653 */         ExtTreeNode extTreeNode = new ExtTreeNode();
/*  654 */         extTreeNode.setId(rs.getString("OcID"));
/*  655 */         extTreeNode.setText(rs.getString("OcID"));
/*  656 */         extTreeNode.setDisabled(false);
/*  657 */         extTreeNode.setAllowDrag(false);
/*  658 */         extTreeNode.setLeaf(true);
/*  659 */         fileList.add(extTreeNode);
/*      */       }
/*      */     } catch (Exception e) {
/*  662 */       e.printStackTrace();
/*  663 */       log.error("query file failed .");
/*      */     } finally {
/*  665 */       dbConClose();
/*      */     }
/*  667 */     return fileList;
/*      */   }
/*      */ 
/*      */   public boolean createSectionInfo(SectionInfoBo bo) {
/*  671 */     boolean flag = true;
/*      */     try {
/*  673 */       dbConInit();
/*  674 */       StringBuffer buf = new StringBuffer();
/*  675 */       buf
/*  676 */         .append(" insert into sectiontotalinfo (OcID,linkID,OcName,ocBeginName,ocBeginLng,ocBeginLat,ocEndName, ");
/*  677 */       buf
/*  678 */         .append(" ocEndLng,ocEndLat,ocType,ocNum,ocLength,ocInspectorName,notes,userid,refreshtime,ocInspectorPhone) values ( ");
/*  679 */       buf.append("'" + bo.getOcID() + "',");
/*  680 */       buf.append("'" + bo.getLinkID() + "',");
/*  681 */       buf.append("'" + bo.getOcName() + "',");
/*  682 */       buf.append("'" + bo.getOcBeginName() + "',");
/*  683 */       buf.append("'" + bo.getOcBeginLng() + "',");
/*  684 */       buf.append("'" + bo.getOcBeginLat() + "',");
/*  685 */       buf.append("'" + bo.getOcEndName() + "',");
/*  686 */       buf.append("'" + bo.getOcEndLng() + "',");
/*  687 */       buf.append("'" + bo.getOcEndLat() + "',");
/*  688 */       buf.append("'" + bo.getOcType() + "',");
/*  689 */       buf.append("'" + bo.getOcNum() + "',");
/*  690 */       buf.append("'" + bo.getOcLength() + "',");
/*  691 */       buf.append("'" + bo.getOcInspectorName() + "',");
/*  692 */       buf.append("'" + bo.getNotes() + "',");
/*  693 */       buf.append("'" + bo.getUserId() + "',");
/*  694 */       buf.append("'" + this.sdf.format(new Date()) + "',");
/*  695 */       buf.append("'" + bo.getOcInspectorPhone() + "' )");
/*  696 */       log.info(buf.toString());
/*  697 */       this.dbcon.execUpdate(buf.toString());
/*      */     }
/*      */     catch (Exception e) {
/*  700 */       e.printStackTrace();
/*  701 */       flag = false;
/*      */     } finally {
/*  703 */       dbConClose();
/*      */     }
/*  705 */     return flag;
/*      */   }
/*      */ 
/*      */   public boolean updateSectionInfoForLinkID(List ocidList, String strLinkID) {
/*  709 */     boolean flag = true;
/*      */     try {
/*  711 */       dbConInit();
/*  712 */       for (int i = 0; i < ocidList.size(); i++)
/*      */       {
/*  714 */         StringBuffer buf = new StringBuffer();
/*  715 */         buf.append(" insert into fiberlinkandsection (linkID,ocid ) ");
/*  716 */         buf.append(" values ('" + strLinkID + "','" + ocidList.get(i) + "' )");
/*  717 */         log.info(buf.toString());
/*  718 */         this.dbcon.execUpdate(buf.toString());
/*      */       }
/*  720 */       log.info("update fiberlink set updateTime = '" + this.sdf.format(new Date()) + "' where id = '" + strLinkID + "'");
/*  721 */       this.dbcon.execUpdate("update fiberlink set updateTime = '" + this.sdf.format(new Date()) + "' where id = '" + strLinkID + "'");
/*      */     } catch (Exception e) {
/*  723 */       flag = false;
/*  724 */       e.printStackTrace();
/*  725 */       log.error(e.getMessage());
/*  726 */       log.error("update fiber link failure ");
/*      */     } finally {
/*  728 */       dbConClose();
/*      */     }
/*  730 */     return flag;
/*      */   }
/*      */ 
/*      */   public boolean deleteSectionInfoForLinkID(String strLinkId, String ocid) {
/*  734 */     boolean flag = true;
/*      */     try {
/*  736 */       dbConInit();
/*  737 */       StringBuffer buf = new StringBuffer();
/*  738 */       buf.append("delete from fiberlinkandsection ");
/*  739 */       buf.append(" where ocid = '" + ocid + "' and linkID = '" + strLinkId + "'");
/*  740 */       log.info(buf.toString());
/*  741 */       this.dbcon.execUpdate(buf.toString());
/*  742 */       log.info("update fiberlink set updateTime = '" + this.sdf.format(new Date()) + "' where id = '" + strLinkId + "'");
/*  743 */       this.dbcon.execUpdate("update fiberlink set updateTime = '" + this.sdf.format(new Date()) + "' where id = '" + strLinkId + "'");
/*      */     }
/*      */     catch (Exception e) {
/*  746 */       flag = false;
/*  747 */       e.printStackTrace();
/*  748 */       log.error(e.getMessage());
/*  749 */       log.error("delete section from link failure ");
/*      */     } finally {
/*  751 */       dbConClose();
/*      */     }
/*  753 */     return flag;
/*      */   }
/*      */ 
/*      */   public boolean updateSectionInfo(SectionInfoBo bo) {
/*  757 */     boolean flag = true;
/*      */     try {
/*  759 */       dbConInit();
/*  760 */       StringBuffer buf = new StringBuffer();
/*  761 */       buf.append("update sectiontotalinfo set ");
/*  762 */       buf.append(" linkID = '" + bo.getLinkID() + "', ");
/*  763 */       buf.append(" OcName = '" + bo.getOcName() + "',");
/*  764 */       buf.append(" ocBeginName = '" + bo.getOcBeginName() + "',");
/*  765 */       buf.append(" ocBeginLng = '" + bo.getOcBeginLng() + "',");
/*  766 */       buf.append(" ocBeginLat = '" + bo.getOcBeginLat() + "',");
/*  767 */       buf.append(" ocEndName = '" + bo.getOcEndName() + "',");
/*  768 */       buf.append(" ocEndLng = '" + bo.getOcEndLng() + "',");
/*  769 */       buf.append(" ocEndLat = '" + bo.getOcEndLat() + "',");
/*  770 */       buf.append(" ocType = '" + bo.getOcType() + "',");
/*  771 */       buf.append(" ocNum = '" + bo.getOcNum() + "',");
/*  772 */       buf.append(" ocLength = '" + bo.getOcLength() + "',");
/*  773 */       buf.append(" ocInspectorName = '" + bo.getOcInspectorName() + "',");
/*  774 */       buf.append(" notes = '" + bo.getNotes() + "',");
/*  775 */       buf.append(" refreshtime = '" + this.sdf.format(new Date()) + "',");
/*  776 */       buf.append(" ocInspectorPhone = '" + bo.getOcInspectorPhone() + 
/*  777 */         "' ");
/*  778 */       buf.append(" where ocid = '" + bo.getOcID() + "'");
/*  779 */       log.info(buf.toString());
/*  780 */       this.dbcon.execUpdate(buf.toString());
/*      */     } catch (Exception e) {
/*  782 */       flag = false;
/*  783 */       e.printStackTrace();
/*  784 */       log.error(e.getMessage());
/*  785 */       log.error("update fiber link failure ");
/*      */     } finally {
/*  787 */       dbConClose();
/*      */     }
/*  789 */     return flag;
/*      */   }
/*      */ 
/*      */   public boolean deleteSectionInfo(String strID) {
/*  793 */     boolean flag = true;
/*      */     try {
/*  795 */       dbConInit();
/*  796 */       String strSQL = "delete from sectiontotalinfo  where OcID = '" + strID + "' ";
/*  797 */       log.info(strSQL);
/*  798 */       this.dbcon.execUpdate(strSQL);
/*  799 */       strSQL = "delete from sectionoutinfo  where OcID = '" + strID + "' ";
/*  800 */       log.info(strSQL);
/*  801 */       this.dbcon.execUpdate(strSQL);
/*  802 */       strSQL = "delete from fiberusedinfo  where fiberid = '" + strID + "' ";
/*  803 */       log.info(strSQL);
/*  804 */       this.dbcon.execUpdate(strSQL);
/*  805 */       strSQL = "delete from usedfibermap  where ocid = '" + strID + "' ";
/*  806 */       log.info(strSQL);
/*  807 */       this.dbcon.execUpdate(strSQL);
/*      */     } catch (Exception e) {
/*  809 */       flag = false;
/*  810 */       e.printStackTrace();
/*  811 */       log.error(e.getMessage());
/*  812 */       log.error("delete section info failure ");
/*      */     } finally {
/*  814 */       dbConClose();
/*      */     }
/*  816 */     return flag;
/*      */   }
/*      */ 
/*      */   private String getCountForOutInfo(String strID, Object queryType, Object queryObj, Object queryRoute)
/*      */   {
/*  821 */     String strSQL = null;
/*  822 */     if (queryObj == null)
/*      */     {
/*  824 */       if (queryType == null)
/*      */       {
/*  826 */         strSQL = "select count(id) from sectionoutinfo where ocid = '" + 
/*  827 */           strID + "'";
/*  828 */         if ((queryRoute != null) && ("QUERY_TYPE_FOR_ROUTE".equalsIgnoreCase(queryRoute.toString().trim()))) {
/*  829 */           strSQL = "select count(id) from sectionoutinfo where ocid = '" + 
/*  830 */             strID + "' and binary ucase(routeInfo) like concat('%',ucase('" + queryObj.toString() + "'),'%')";
/*      */         }
/*      */       }
/*  833 */       else if ("isRes".equals(queryType)) {
/*  834 */         strSQL = "select count(id) from sectionoutinfo where ocid = '" + 
/*  835 */           strID + "' and isRes = '1'";
/*  836 */       } else if ("isNode".equals(queryType)) {
/*  837 */         strSQL = "select count(id) from sectionoutinfo where ocid = '" + 
/*  838 */           strID + "' and isJoint = '1'";
/*      */       } else {
/*  840 */         strSQL = "select count(id) from sectionoutinfo where ocid = '" + 
/*  841 */           strID + "'";
/*      */       }
/*      */     }
/*  844 */     else if (queryType == null)
/*      */     {
/*  846 */       strSQL = "select count(id) from sectionoutinfo where ocid = '" + 
/*  847 */         strID + "'  and ( (binary ucase(poleNum) like concat('%',ucase('" + queryObj.toString() + "'),'%')) " + 
/*  848 */         " or ( binary ucase(routeInfo) like concat('%',ucase('" + queryObj.toString() + "'),'%') ))";
/*  849 */       if ((queryRoute != null) && ("QUERY_TYPE_FOR_ROUTE".equalsIgnoreCase(queryRoute.toString().trim())))
/*  850 */         strSQL = "select count(id) from sectionoutinfo where ocid = '" + 
/*  851 */           strID + "'  and binary ucase(routeInfo) like concat('%',ucase('" + queryObj.toString() + "'),'%') ";
/*  852 */     } else if ("isRes".equals(queryType)) {
/*  853 */       strSQL = "select count(id) from sectionoutinfo where ocid = '" + 
/*  854 */         strID + "' and isRes = '1' and binary ucase(poleNum) like concat('%',ucase('" + queryObj.toString() + "'),'%')";
/*  855 */     } else if ("isNode".equals(queryType)) {
/*  856 */       strSQL = "select count(id) from sectionoutinfo where ocid = '" + 
/*  857 */         strID + "' and isJoint = '1' and binary ucase(poleNum) like concat('%',ucase('" + queryObj.toString() + "'),'%')";
/*      */     } else {
/*  859 */       strSQL = "select count(id) from sectionoutinfo where ocid = '" + 
/*  860 */         strID + "' and binary ucase(poleNum) like concat('%',ucase('" + queryObj.toString() + "'),'%')";
/*      */     }
/*  862 */     return strSQL;
/*      */   }
/*      */ 
/*      */   private String getSQLForSectionOutInfo(String strID, Object queryType, Object queryObj, int start, int limit, Object queryRoute)
/*      */   {
/*      */     String strSQL;
/*  868 */     if ((queryObj == null) || ("".endsWith(queryObj.toString().trim())))
/*      */     {
/*  870 */       if ("isRes".equals(queryType)) {
/*  871 */         strSQL = "select * from sectionoutinfo where ocid = '" + strID + 
/*  872 */           "' and isRes = '1' order by outOrder limit " + start + ", " + limit;
/*      */       }
/*      */       else
/*      */       {
/*  873 */         if ("isNode".equals(queryType)) {
/*  874 */           strSQL = "select * from sectionoutinfo where ocid = '" + strID + 
/*  875 */             "' and isJoint = '1' order by outOrder limit " + start + ", " + limit;
/*      */         } else {
/*  877 */           strSQL = "select * from sectionoutinfo where ocid = '" + strID + 
/*  878 */             "' order by outOrder  limit " + start + ", " + limit;
/*  879 */           if ((queryRoute != null) && ("QUERY_TYPE_FOR_ROUTE".equalsIgnoreCase(queryRoute.toString().trim())))
/*  880 */             strSQL = "select * from sectionoutinfo where ocid = '" + strID + 
/*  881 */               "' and  binary ucase(routeInfo) like concat('%',ucase('" + queryObj.toString() + "'),'%') order by outOrder  limit " + start + ", " + limit;
/*      */         }
/*      */       }
/*      */     }
/*      */     else
/*      */     {
/*  885 */       if ("isRes".equals(queryType)) {
/*  886 */         strSQL = "select * from sectionoutinfo where ocid = '" + strID + 
/*  887 */           "' and  binary ucase(poleNum) like concat('%',ucase('" + queryObj.toString() + "'),'%') " + 
/*  888 */           " and isRes = '1'  order by outOrder limit " + start + ", " + limit;
/*      */       }
/*      */       else
/*      */       {
/*  889 */         if ("isNode".equals(queryType)) {
/*  890 */           strSQL = "select * from sectionoutinfo where ocid = '" + strID + 
/*  891 */             "' and binary ucase(poleNum) like concat('%',ucase('" + queryObj.toString() + "'),'%')" + 
/*  892 */             " and isJoint = '1'  order by outOrder limit " + start + ", " + limit;
/*      */         } else {
/*  894 */           strSQL = "select * from sectionoutinfo where ocid = '" + strID + 
/*  895 */             "' and ( (binary ucase(poleNum)   like concat('%',ucase('" + queryObj.toString() + "'),'%')) " + 
/*  896 */             "    or  ( binary ucase(routeInfo) like concat('%',ucase('" + queryObj.toString() + "'),'%')))" + 
/*  897 */             "  order by outOrder limit " + start + ", " + limit;
/*  898 */           if ((queryRoute != null) && ("QUERY_TYPE_FOR_ROUTE".equalsIgnoreCase(queryRoute.toString().trim())))
/*  899 */             strSQL = "select * from sectionoutinfo where ocid = '" + strID + 
/*  900 */               "' and binary ucase(routeInfo) like concat('%',ucase('" + queryObj.toString() + "'),'%') " + 
/*  901 */               "  order by outOrder limit " + start + ", " + limit; 
/*      */         }
/*      */       }
/*      */     }
/*  904 */     return strSQL;
/*      */   }
/*      */ 
/*      */   public ListContentsBFO getSectionOutInfoList(Map condition) {
/*  908 */     log.info(" query section out info by id .");
/*  909 */     dbConInit();
/*  910 */     ListContentsBFO bfo = new ListContentsBFO();
/*  911 */     String strID = condition.get("id").toString();
/*  912 */     Object queryType = condition.get("queryType");
/*  913 */     int start = Integer.parseInt(condition.get("start").toString());
/*  914 */     int limit = Integer.parseInt(condition.get("limit").toString());
/*  915 */     ResultSet rs = null;
/*  916 */     List list = new ArrayList();
/*      */     try {
/*  918 */       Object queryObj = condition.get("query");
/*  919 */       Object queryRoute = condition.get("QUERY_TYPE");
/*  920 */       String strSQL = getCountForOutInfo(strID, queryType, queryObj, queryRoute);
/*      */ 
/*  923 */       log.info(strSQL);
/*  924 */       rs = this.dbcon.execQuery(strSQL);
/*  925 */       if (rs.next()) {
/*  926 */         bfo.setTotalSize(rs.getInt(1));
/*      */       }
/*      */ 
/*  930 */       strSQL = getSQLForSectionOutInfo(strID, queryType, queryObj, start, limit, queryRoute);
/*      */ 
/*  932 */       log.info(strSQL);
/*  933 */       rs = this.dbcon.execQuery(strSQL);
/*  934 */       int count = 0;
/*  935 */       while (rs.next()) {
/*  936 */         SectionOutInfoBO bo = new SectionOutInfoBO();
/*  937 */         bo.setId(String.valueOf(count++));
/*  938 */         bo.setBoid(rs.getString("id"));
/*  939 */         bo.setOutOrder(rs.getInt("outOrder"));
/*  940 */         bo.setOcid(rs.getString("ocid"));
/*  941 */         bo.setOcName(rs.getString("ocName"));
/*  942 */         bo.setPoleNum(rs.getString("poleNum"));
/*  943 */         bo.setPropertyRight(rs.getString("propertyRight"));
/*  944 */         bo.setLongleath1(rs.getString("longleath1"));
/*  945 */         bo.setLongleath2(rs.getString("longleath2"));
/*  946 */         bo.setLng(rs.getString("lng"));
/*  947 */         bo.setLat(rs.getString("lat"));
/*  948 */         bo.setDistance(rs.getString("distance"));
/*  949 */         bo.setIsNode(rs.getString("isNode"));
/*  950 */         bo.setIsJoint(rs.getString("isJoint"));
/*  951 */         bo.setIsRes(rs.getString("isRes"));
/*  952 */         bo.setResLength(rs.getString("resLength"));
/*  953 */         bo.setGranularity(rs.getString("granularity"));
/*  954 */         bo.setUpdateTime(rs.getDate("updateTime"));
/*  955 */         bo.setOcLayType(rs.getString("ocLayType"));
/*  956 */         bo.setRouteInfo(rs.getString("routeInfo"));
/*  957 */         bo.setPreviousid(rs.getString("previousid"));
/*  958 */         bo.setLightningprotection(rs.getString("lightningprotection"));
/*  959 */         bo.setWiredrawing(rs.getString("wiredrawing"));
/*  960 */         bo.setStrutnum(rs.getString("strutnum"));
/*  961 */         bo.setZone(rs.getString("zone"));
/*  962 */         list.add(bo);
/*      */       }
/*  964 */       bfo.setData(list.toArray());
/*      */     } catch (Exception e) {
/*  966 */       e.printStackTrace();
/*  967 */       log.error("query fiber section failed .");
/*      */     } finally {
/*  969 */       dbConClose();
/*      */     }
/*  971 */     return bfo;
/*      */   }
/*      */ 
/*      */   public boolean createSectionOutInfo(SectionOutInfoBO bo) {
/*  975 */     boolean flag = true;
/*      */     try {
/*  977 */       dbConInit();
/*  978 */       double dGranularity = queryGranularityForCreate(this.dbcon, 
/*  979 */         bo.getOcid(), bo.getOutOrder() - 1);
/*      */ 
/*  981 */       dGranularity = dGranularity + (Double.parseDouble(bo.getDistance()) + 
/*  981 */         Double.parseDouble(bo.getResLength()));
/*  982 */       StringBuffer buf = new StringBuffer();
/*  983 */       buf
/*  984 */         .append(" insert into sectionoutinfo (id,outOrder,ocid,OcName,poleNum,propertyRight,Longleath1,Longleath2,");
/*  985 */       buf
/*  986 */         .append(" lng,lat,distance,isNode,isJoint,isRes,resLength,updateTime,ocLayType,routeInfo,granularity,previousid,lightningprotection,wiredrawing,strutnum,zone ) values ( ");
/*  987 */       buf.append("'" + bo.getId() + "',");
/*  988 */       buf.append("'" + bo.getOutOrder() + "',");
/*  989 */       buf.append("'" + bo.getOcid() + "',");
/*  990 */       buf.append("'" + bo.getOcName() + "',");
/*  991 */       buf.append("'" + bo.getPoleNum() + "',");
/*  992 */       buf.append("'" + bo.getPropertyRight() + "',");
/*  993 */       buf.append("'" + bo.getLongleath1() + "',");
/*  994 */       buf.append("'" + bo.getLongleath2() + "',");
/*  995 */       buf.append("'" + bo.getLng() + "',");
/*  996 */       buf.append("'" + bo.getLat() + "',");
/*  997 */       buf.append("'" + bo.getDistance() + "',");
/*  998 */       buf.append("'" + bo.getIsNode() + "',");
/*  999 */       buf.append("'" + bo.getIsJoint() + "',");
/* 1000 */       buf.append("'" + bo.getIsRes() + "',");
/* 1001 */       buf.append("'" + bo.getResLength() + "',");
/* 1002 */       buf.append("'" + this.sdf.format(new Date()) + "',");
/* 1003 */       buf.append("'" + bo.getOcLayType() + "',");
/* 1004 */       buf.append("'" + bo.getRouteInfo() + "' ,");
/* 1005 */       buf.append("'" + dGranularity + "' ,");
/*      */ 
/* 1007 */       buf.append("'" + bo.getPreviousid() + "' ,");
/* 1008 */       buf.append("'" + bo.getLightningprotection() + "' ,");
/* 1009 */       buf.append("'" + bo.getWiredrawing() + "' ,");
/* 1010 */       buf.append("'" + bo.getStrutnum() + "' ,");
/* 1011 */       buf.append("'" + bo.getZone() + "' )");
/* 1012 */       log.info(buf.toString());
/* 1013 */       this.dbcon.execUpdate(buf.toString());
/*      */     } catch (Exception e) {
/* 1015 */       e.printStackTrace();
/* 1016 */       flag = false;
/*      */     } finally {
/* 1018 */       dbConClose();
/*      */     }
/* 1020 */     return flag;
/*      */   }
/*      */ 
/*      */   private double queryGranularityForCreate(dbConnector conn, String strOcId, int outOrder)
/*      */   {
/* 1025 */     double dGranularity = 0.0D;
/*      */     try {
/* 1027 */       String strSQL = "select granularity from sectionoutinfo where ocid = '" + 
/* 1028 */         strOcId + "'  and outOrder = '" + outOrder + "'";
/* 1029 */       log.info(strSQL);
/* 1030 */       ResultSet rs = conn.execQuery(strSQL);
/* 1031 */       if (rs.next())
/* 1032 */         dGranularity = Double.parseDouble(rs.getString("granularity"));
/*      */     }
/*      */     catch (Exception e)
/*      */     {
/* 1036 */       e.printStackTrace();
/*      */     }
/* 1038 */     return dGranularity;
/*      */   }
/*      */ 
/*      */   public void updateGranularity(String strOcId) {
/*      */     try {
/* 1043 */       dbConInit();
/* 1044 */       String strSQL = "select id,outOrder,distance,resLength from sectionoutinfo where ocid = '" + 
/* 1045 */         strOcId + "' order by outOrder,updatetime desc";
/* 1046 */       log.info(strSQL);
/* 1047 */       ResultSet rs = null;
/* 1048 */       List list = new ArrayList();
/* 1049 */       rs = this.dbcon.execQuery(strSQL);
/* 1050 */       while (rs.next()) {
/* 1051 */         SectionOutInfoBO bo = new SectionOutInfoBO();
/* 1052 */         bo.setId(rs.getString("id"));
/* 1053 */         bo.setOutOrder(rs.getInt("outOrder"));
/* 1054 */         bo.setDistance(rs.getString("distance"));
/* 1055 */         bo.setResLength(rs.getString("resLength"));
/* 1056 */         list.add(bo);
/*      */       }
/* 1058 */       list = countGranularity(list);
/* 1059 */       for (int i = 0; i < list.size(); i++) {
/* 1060 */         log.info(list.get(i).toString());
/* 1061 */         this.dbcon.execUpdate(list.get(i).toString());
/*      */       }
/*      */     }
/*      */     catch (Exception e) {
/* 1065 */       e.printStackTrace();
/*      */     } finally {
/* 1067 */       dbConClose();
/*      */     }
/*      */   }
/*      */ 
/*      */   private List countGranularity(List objList) {
/* 1072 */     List list = new ArrayList();
/* 1073 */     double distance = 0.0D;
/* 1074 */     double resLength = 0.0D;
/* 1075 */     double granularity = 0.0D;
/* 1076 */     int count = 1;
/* 1077 */     int objSize = objList.size();
/* 1078 */     for (int intOrder = 0; intOrder < objSize; intOrder++)
/*      */     {
/* 1080 */       count = intOrder;
/* 1081 */       Object obj = objList.get(intOrder);
/* 1082 */       SectionOutInfoBO bo = (SectionOutInfoBO)obj;
/* 1083 */       distance = Double.parseDouble(bo.getDistance());
/* 1084 */       resLength = Double.parseDouble(bo.getResLength());
/* 1085 */       if (intOrder == 0)
/* 1086 */         granularity = distance + resLength;
/*      */       else
/* 1088 */         granularity += distance + resLength;
/* 1089 */       list.add("update sectionoutinfo set outOrder = '" + intOrder + 
/* 1090 */         "',granularity = '" + granularity + "' where id = '" + 
/* 1091 */         bo.getId() + "'");
/*      */     }
/* 1093 */     return list;
/*      */   }
/*      */ 
/*      */   public boolean updateSectionOutInfo(SectionOutInfoBO bo) {
/* 1097 */     boolean flag = true;
/*      */     try {
/* 1099 */       dbConInit();
/* 1100 */       StringBuffer buf = new StringBuffer();
/* 1101 */       buf.append("update sectionoutinfo set ");
/* 1102 */       buf.append(" outOrder = '" + bo.getOutOrder() + "', ");
/* 1103 */       buf.append(" ocid = '" + bo.getOcid() + "', ");
/* 1104 */       buf.append(" OcName = '" + bo.getOcName() + "',");
/* 1105 */       buf.append(" poleNum = '" + bo.getPoleNum() + "',");
/* 1106 */       buf.append(" propertyRight = '" + bo.getPropertyRight() + "',");
/* 1107 */       buf.append(" Longleath1 = '" + bo.getLongleath1() + "',");
/* 1108 */       buf.append(" Longleath2 = '" + bo.getLongleath2() + "',");
/* 1109 */       buf.append(" lng = '" + bo.getLng() + "',");
/* 1110 */       buf.append(" lat = '" + bo.getLat() + "',");
/* 1111 */       buf.append(" distance = '" + bo.getDistance() + "',");
/* 1112 */       buf.append(" isNode = '" + bo.getIsNode() + "',");
/* 1113 */       buf.append(" isJoint = '" + bo.getIsJoint() + "',");
/* 1114 */       buf.append(" isRes = '" + bo.getIsRes() + "',");
/* 1115 */       buf.append(" resLength = '" + bo.getResLength() + "',");
/*      */ 
/* 1117 */       buf.append(" updateTime = '" + this.sdf.format(new Date()) + "', ");
/* 1118 */       buf.append(" ocLayType = '" + bo.getOcLayType() + "' ,");
/* 1119 */       buf.append(" routeInfo = '" + bo.getRouteInfo() + "', ");
/* 1120 */       buf.append(" previousid = '" + bo.getPreviousid() + "' ,");
/* 1121 */       buf.append(" lightningprotection = '" + bo.getLightningprotection() + "' ,");
/* 1122 */       buf.append(" wiredrawing = '" + bo.getWiredrawing() + "' ,");
/* 1123 */       buf.append(" strutnum = '" + bo.getStrutnum() + "' ,");
/* 1124 */       buf.append(" zone = '" + bo.getZone() + "' ");
/*      */ 
/* 1127 */       buf.append(" where id = '" + bo.getId() + "'");
/* 1128 */       log.info(buf.toString());
/* 1129 */       this.dbcon.execUpdate(buf.toString());
/*      */     } catch (Exception e) {
/* 1131 */       flag = false;
/* 1132 */       e.printStackTrace();
/* 1133 */       log.error(e.getMessage());
/* 1134 */       log.error("update fiber link failure ");
/*      */     } finally {
/* 1136 */       dbConClose();
/*      */     }
/* 1138 */     return flag;
/*      */   }
/*      */ 
/*      */   public boolean deleteSectionOutInfo(String strId) {
/* 1142 */     boolean flag = true;
/*      */     try {
/* 1144 */       dbConInit();
/* 1145 */       String strSQL = "delete from sectionoutinfo  where id = '" + strId + 
/* 1146 */         "' ";
/* 1147 */       log.info(strSQL);
/* 1148 */       this.dbcon.execUpdate(strSQL);
/*      */     } catch (Exception e) {
/* 1150 */       flag = false;
/* 1151 */       e.printStackTrace();
/* 1152 */       log.error(e.getMessage());
/* 1153 */       log.error("delete section out info failure ");
/*      */     } finally {
/* 1155 */       dbConClose();
/*      */     }
/* 1157 */     return flag;
/*      */   }
/*      */ 
/*      */   public boolean deleteFiberInfo(String strId) {
/* 1161 */     boolean flag = true;
/*      */     try {
/* 1163 */       dbConInit();
/* 1164 */       String strSQL = "delete from fiberinfo  where fiberid = '" + strId + 
/* 1165 */         "' ";
/* 1166 */       log.info(strSQL);
/* 1167 */       this.dbcon.execUpdate(strSQL);
/*      */     } catch (Exception e) {
/* 1169 */       flag = false;
/* 1170 */       e.printStackTrace();
/* 1171 */       log.error(e.getMessage());
/* 1172 */       log.error("delete fiber info failure ");
/*      */     } finally {
/* 1174 */       dbConClose();
/*      */     }
/* 1176 */     return flag;
/*      */   }
/*      */ 
/*      */   public ListContentsBFO getFiberInfoList(Map condition) {
/* 1180 */     log.info(" query fiber info by id .");
/* 1181 */     dbConInit();
/* 1182 */     String ocid = condition.get("id").toString();
/* 1183 */     int start = Integer.parseInt(condition.get("start").toString());
/* 1184 */     int limit = Integer.parseInt(condition.get("limit").toString());
/* 1185 */     ResultSet rs = null;
/* 1186 */     ListContentsBFO bfo = new ListContentsBFO();
/* 1187 */     List list = new ArrayList();
/*      */     try
/*      */     {
/* 1190 */       String strSQL = "select count(fiberid) from fiberinfo where ocid = '" + 
/* 1191 */         ocid + "'";
/*      */ 
/* 1193 */       log.info(strSQL);
/* 1194 */       rs = this.dbcon.execQuery(strSQL);
/* 1195 */       if (rs.next())
/* 1196 */         bfo.setTotalSize(rs.getInt(1));
/* 1197 */       strSQL = "select * from fiberinfo where ocid = '" + ocid + 
/* 1198 */         "' limit " + start + ", " + limit;
/*      */ 
/* 1200 */       log.info(strSQL);
/* 1201 */       rs = this.dbcon.execQuery(strSQL);
/* 1202 */       while (rs.next()) {
/* 1203 */         FiberInfoBO bo = new FiberInfoBO();
/* 1204 */         bo.setId(rs.getString("fiberid"));
/* 1205 */         bo.setFiberid(rs.getString("fiberid"));
/* 1206 */         bo.setOcid(rs.getString("ocid"));
/* 1207 */         bo.setOcName(rs.getString("ocName"));
/* 1208 */         bo.setBtsName(rs.getString("btsName"));
/* 1209 */         bo.setOcLayType(rs.getString("ocLayType"));
/* 1210 */         bo.setOcNum(rs.getInt("ocNum"));
/* 1211 */         bo.setOcLength(rs.getDouble("ocLength"));
/* 1212 */         bo.setRefractive(rs.getDouble("refractive"));
/* 1213 */         bo.setWavelength(rs.getDouble("wavelength"));
/* 1214 */         bo.setInstrumentName(rs.getString("instrumentName"));
/* 1215 */         bo.setPost(rs.getString("post"));
/* 1216 */         bo.setTester(rs.getString("tester"));
/* 1217 */         bo.setTestTime(rs.getString("testTime"));
/* 1218 */         list.add(bo);
/*      */       }
/* 1220 */       bfo.setData(list.toArray());
/*      */     } catch (Exception e) {
/* 1222 */       e.printStackTrace();
/* 1223 */       log.error("query fiber info failed .");
/*      */     } finally {
/* 1225 */       dbConClose();
/*      */     }
/* 1227 */     return bfo;
/*      */   }
/*      */ 
/*      */   public FiberInfoBO getFiberInfoByOcId(String strOcid) {
/* 1231 */     log.info(" query fiber info by strOcid .");
/* 1232 */     dbConInit();
/* 1233 */     ResultSet rs = null;
/* 1234 */     FiberInfoBO bo = null;
/* 1235 */     List list = new ArrayList();
/*      */     try
/*      */     {
/* 1239 */       String strSQL = "select * from fiberinfo where ocid = '" + strOcid + "' ";
/*      */ 
/* 1241 */       log.info(strSQL);
/* 1242 */       rs = this.dbcon.execQuery(strSQL);
/* 1243 */       if (rs.next()) {
/* 1244 */         bo = new FiberInfoBO();
/* 1245 */         bo.setId(rs.getString("fiberid"));
/* 1246 */         bo.setFiberid(rs.getString("fiberid"));
/* 1247 */         bo.setOcid(rs.getString("ocid"));
/* 1248 */         bo.setOcName(rs.getString("ocName"));
/* 1249 */         bo.setBtsName(rs.getString("btsName"));
/* 1250 */         bo.setOcLayType(rs.getString("ocLayType"));
/* 1251 */         bo.setOcNum(rs.getInt("ocNum"));
/* 1252 */         bo.setOcLength(rs.getDouble("ocLength"));
/* 1253 */         bo.setRefractive(rs.getDouble("refractive"));
/* 1254 */         bo.setWavelength(rs.getDouble("wavelength"));
/* 1255 */         bo.setInstrumentName(rs.getString("instrumentName"));
/* 1256 */         bo.setPost(rs.getString("post"));
/* 1257 */         bo.setTester(rs.getString("tester"));
/* 1258 */         bo.setTestTime(rs.getString("testTime"));
/*      */       }
/*      */     }
/*      */     catch (Exception e) {
/* 1262 */       e.printStackTrace();
/* 1263 */       log.error("query fiber info failed .");
/*      */     } finally {
/* 1265 */       dbConClose();
/*      */     }
/* 1267 */     return bo;
/*      */   }
/*      */ 
/*      */   public FiberInfoBO getFiberInfo(String strFiberId) {
/* 1271 */     log.info(" query fiber info by id .");
/* 1272 */     dbConInit();
/* 1273 */     ResultSet rs = null;
/* 1274 */     FiberInfoBO bo = null;
/*      */     try
/*      */     {
/* 1277 */       String strSQL = "select * from fiberinfo where fiberid = '" + 
/* 1278 */         strFiberId + "' ";
/*      */ 
/* 1280 */       log.info(strSQL);
/* 1281 */       rs = this.dbcon.execQuery(strSQL);
/* 1282 */       if (rs.next()) {
/* 1283 */         bo = new FiberInfoBO();
/* 1284 */         bo.setId(rs.getString("fiberid"));
/* 1285 */         bo.setFiberid(rs.getString("fiberid"));
/* 1286 */         bo.setOcid(rs.getString("ocid"));
/* 1287 */         bo.setOcName(rs.getString("ocName"));
/* 1288 */         bo.setBtsName(rs.getString("btsName"));
/* 1289 */         bo.setOcLayType(rs.getString("ocLayType"));
/* 1290 */         bo.setOcNum(rs.getInt("ocNum"));
/* 1291 */         bo.setOcLength(rs.getDouble("ocLength"));
/* 1292 */         bo.setRefractive(rs.getDouble("refractive"));
/* 1293 */         bo.setWavelength(rs.getDouble("wavelength"));
/* 1294 */         bo.setInstrumentName(rs.getString("instrumentName"));
/* 1295 */         bo.setPost(rs.getString("post"));
/* 1296 */         bo.setTester(rs.getString("tester"));
/* 1297 */         bo.setTestTime(rs.getString("testTime"));
/*      */       }
/*      */     } catch (Exception e) {
/* 1300 */       e.printStackTrace();
/* 1301 */       log.error("query fiber info failed .");
/*      */     } finally {
/* 1303 */       dbConClose();
/*      */     }
/* 1305 */     return bo;
/*      */   }
/*      */ 
/*      */   public boolean createFiberInfo(FiberInfoBO bo) {
/* 1309 */     boolean flag = true;
/*      */     try {
/* 1311 */       dbConInit();
/* 1312 */       StringBuffer buf = new StringBuffer();
/* 1313 */       buf
/* 1314 */         .append(" insert into fiberinfo (fiberid,ocid,OcName,btsName,ocLayType,ocNum,ocLength,wavelength,refractive,instrumentName,post,tester,testTime) values (");
/* 1315 */       buf.append("'" + bo.getFiberid() + "',");
/* 1316 */       buf.append("'" + bo.getOcid() + "',");
/* 1317 */       buf.append("'" + bo.getOcName() + "',");
/* 1318 */       buf.append("'" + bo.getBtsName() + "',");
/* 1319 */       buf.append("'" + bo.getOcLayType() + "',");
/* 1320 */       buf.append("'" + bo.getOcNum() + "',");
/* 1321 */       buf.append("'" + bo.getOcLength() + "',");
/* 1322 */       buf.append("'" + bo.getWavelength() + "',");
/* 1323 */       buf.append("'" + bo.getRefractive() + "',");
/* 1324 */       buf.append("'" + bo.getInstrumentName() + "',");
/* 1325 */       buf.append("'" + bo.getPost() + "',");
/* 1326 */       buf.append("'" + bo.getTester() + "',");
/* 1327 */       buf.append("'" + this.sdf.format(new Date()) + "' )");
/* 1328 */       log.info(buf.toString());
/* 1329 */       this.dbcon.execUpdate(buf.toString());
/*      */     } catch (Exception e) {
/* 1331 */       e.printStackTrace();
/* 1332 */       flag = false;
/*      */     } finally {
/* 1334 */       dbConClose();
/*      */     }
/* 1336 */     return flag;
/*      */   }
/*      */ 
/*      */   public boolean updateFiberInfo(FiberInfoBO bo) {
/* 1340 */     boolean flag = true;
/*      */     try {
/* 1342 */       dbConInit();
/* 1343 */       StringBuffer buf = new StringBuffer();
/* 1344 */       buf.append("update fiberinfo set ");
/* 1345 */       buf.append("ocid = '" + bo.getOcid() + "',");
/* 1346 */       buf.append("OcName = '" + bo.getOcName() + "',");
/* 1347 */       buf.append("btsName = '" + bo.getBtsName() + "',");
/* 1348 */       buf.append("ocLayType = '" + bo.getOcLayType() + "',");
/* 1349 */       buf.append("ocNum = '" + bo.getOcNum() + "',");
/* 1350 */       buf.append("ocLength = '" + bo.getOcLength() + "',");
/* 1351 */       buf.append("wavelength = '" + bo.getWavelength() + "',");
/* 1352 */       buf.append("refractive = '" + bo.getRefractive() + "',");
/* 1353 */       buf.append("instrumentName = '" + bo.getInstrumentName() + "',");
/* 1354 */       buf.append("post = '" + bo.getPost() + "',");
/* 1355 */       buf.append("tester = '" + bo.getTester() + "',");
/* 1356 */       buf.append("testTime = '" + this.sdf.format(new Date()) + "' ");
/* 1357 */       buf.append(" where fiberid = '" + bo.getFiberid() + "'");
/* 1358 */       log.info(buf.toString());
/* 1359 */       this.dbcon.execUpdate(buf.toString());
/*      */     } catch (Exception e) {
/* 1361 */       e.printStackTrace();
/* 1362 */       flag = false;
/*      */     } finally {
/* 1364 */       dbConClose();
/*      */     }
/* 1366 */     return flag;
/*      */   }
/*      */ 
/*      */   public ListContentsBFO getFiberUsedInfoList(Map condition) {
/* 1370 */     log.info(" query fiber used info by id .");
/* 1371 */     dbConInit();
/* 1372 */     ListContentsBFO bfo = new ListContentsBFO();
/* 1373 */     String strID = condition.get("id").toString();
/* 1374 */     int start = Integer.parseInt(condition.get("start").toString());
/* 1375 */     int limit = Integer.parseInt(condition.get("limit").toString());
/* 1376 */     ResultSet rs = null;
/* 1377 */     List list = new ArrayList();
/*      */     try {
/* 1379 */       String strSQL = "select count(id) from fiberusedinfo where fiberid = '" + 
/* 1380 */         strID + "'";
/*      */ 
/* 1382 */       log.info(strSQL);
/* 1383 */       rs = this.dbcon.execQuery(strSQL);
/* 1384 */       if (rs.next()) {
/* 1385 */         bfo.setTotalSize(rs.getInt(1));
/*      */       }
/* 1387 */       strSQL = "select * from fiberusedinfo where fiberid = '" + strID + 
/* 1388 */         "' limit " + start + ", " + limit;
/*      */ 
/* 1390 */       log.info(strSQL);
/* 1391 */       rs = this.dbcon.execQuery(strSQL);
/* 1392 */       while (rs.next()) {
/* 1393 */         FiberUsedInfoBO bo = new FiberUsedInfoBO();
/* 1394 */         bo.setId(rs.getString("id"));
/* 1395 */         bo.setNo(rs.getString("no"));
/* 1396 */         bo.setFiberid(rs.getString("fiberid"));
/* 1397 */         bo.setTestDirection(rs.getString("testDirection"));
/* 1398 */         bo.setDecibel(rs.getDouble("decibel"));
/* 1399 */         bo.setAllDb(rs.getDouble("allDb"));
/* 1400 */         bo.setBeginPosition(rs.getString("beginPosition"));
/* 1401 */         bo.setBeginMachineType(rs.getString("beginMachineType"));
/* 1402 */         bo.setDirection(rs.getString("direction"));
/* 1403 */         bo.setEndPosition(rs.getString("endPosition"));
/* 1404 */         bo.setEndMachineType(rs.getString("endMachineType"));
/* 1405 */         list.add(bo);
/*      */       }
/* 1407 */       bfo.setData(list.toArray());
/*      */     } catch (Exception e) {
/* 1409 */       e.printStackTrace();
/* 1410 */       log.error("query fiber used info failed .");
/*      */     } finally {
/* 1412 */       dbConClose();
/*      */     }
/* 1414 */     return bfo;
/*      */   }
/*      */ 
/*      */   public ListContentsBFO getFiberCoreList(Map condition)
/*      */   {
/* 1419 */     log.info(" query fibercore by id .");
/* 1420 */     dbConInit();
/* 1421 */     String ocid = condition.get("id").toString();
/* 1422 */     int start = Integer.parseInt(condition.get("start").toString());
/* 1423 */     int limit = Integer.parseInt(condition.get("limit").toString());
/* 1424 */     ResultSet rs = null;
/* 1425 */     ListContentsBFO bfo = new ListContentsBFO();
/* 1426 */     List list = new ArrayList();
/*      */     try
/*      */     {
/* 1429 */       String strSQL = "select count(id) from fibercore where no = '" + 
/* 1430 */         ocid + "'";
/*      */ 
/* 1432 */       log.info(strSQL);
/* 1433 */       rs = this.dbcon.execQuery(strSQL);
/* 1434 */       if (rs.next())
/* 1435 */         bfo.setTotalSize(rs.getInt(1));
/* 1436 */       strSQL = "select * from fibercore where no = '" + ocid + 
/* 1437 */         "' limit " + start + ", " + limit;
/*      */ 
/* 1439 */       log.info(strSQL);
/* 1440 */       rs = this.dbcon.execQuery(strSQL);
/* 1441 */       while (rs.next()) {
/* 1442 */         FibercoreBO bo = new FibercoreBO();
/* 1443 */         bo.setId(rs.getString("id"));
/* 1444 */         bo.setNo(rs.getString("no"));
/* 1445 */         bo.setOcName(rs.getString("ocName"));
/* 1446 */         bo.setFiberType(rs.getString("fiberType"));
/* 1447 */         bo.setTestLength(rs.getString("testLength"));
/* 1448 */         bo.setUsedInfo(rs.getString("usedInfo"));
/* 1449 */         bo.setOther1(rs.getString("other1"));
/* 1450 */         bo.setOther2(rs.getString("other2"));
/* 1451 */         list.add(bo);
/*      */       }
/* 1453 */       bfo.setData(list.toArray());
/*      */     } catch (Exception e) {
/* 1455 */       e.printStackTrace();
/* 1456 */       log.error("query fiber info failed .");
/*      */     } finally {
/* 1458 */       dbConClose();
/*      */     }
/* 1460 */     return bfo;
/*      */   }
/*      */ 
/*      */   public boolean createFiberUsedInfo(FiberUsedInfoBO bo)
/*      */   {
/* 1465 */     boolean flag = true;
/*      */     try {
/* 1467 */       dbConInit();
/* 1468 */       StringBuffer buf = new StringBuffer();
/* 1469 */       buf
/* 1470 */         .append(" insert into fiberusedinfo (id,no,fiberid,testDirection,decibel,allDb,beginPosition,beginMachineType,direction,endPosition,endMachineType ) values (");
/* 1471 */       buf.append("'" + bo.getId() + "',");
/* 1472 */       buf.append("'" + bo.getNo() + "',");
/* 1473 */       buf.append("'" + bo.getFiberid() + "',");
/* 1474 */       buf.append("'" + bo.getTestDirection() + "',");
/* 1475 */       buf.append("'" + bo.getDecibel() + "',");
/* 1476 */       buf.append("'" + bo.getAllDb() + "',");
/* 1477 */       buf.append("'" + bo.getBeginPosition() + "',");
/* 1478 */       buf.append("'" + bo.getBeginMachineType() + "',");
/* 1479 */       buf.append("'" + bo.getDirection() + "',");
/* 1480 */       buf.append("'" + bo.getEndPosition() + "',");
/* 1481 */       buf.append("'" + bo.getEndMachineType() + "' )");
/* 1482 */       log.info(buf.toString());
/* 1483 */       this.dbcon.execUpdate(buf.toString());
/*      */     } catch (Exception e) {
/* 1485 */       e.printStackTrace();
/* 1486 */       flag = false;
/*      */     } finally {
/* 1488 */       dbConClose();
/*      */     }
/* 1490 */     return flag;
/*      */   }
/*      */ 
/*      */   public boolean updateFiberUsedInfo(FiberUsedInfoBO bo) {
/* 1494 */     boolean flag = true;
/*      */     try {
/* 1496 */       dbConInit();
/* 1497 */       StringBuffer buf = new StringBuffer();
/* 1498 */       buf.append("update fiberusedinfo set ");
/* 1499 */       buf.append("fiberid = '" + bo.getFiberid() + "',");
/* 1500 */       buf.append("no = '" + bo.getNo() + "',");
/* 1501 */       buf.append("testDirection = '" + bo.getTestDirection() + "',");
/* 1502 */       buf.append("decibel = '" + bo.getDecibel() + "',");
/* 1503 */       buf.append("allDb = '" + bo.getAllDb() + "',");
/* 1504 */       buf.append("beginPosition = '" + bo.getBeginPosition() + "',");
/* 1505 */       buf
/* 1506 */         .append("beginMachineType = '" + bo.getBeginMachineType() + 
/* 1507 */         "',");
/* 1508 */       buf.append("direction = '" + bo.getDirection() + "',");
/* 1509 */       buf.append("endPosition = '" + bo.getEndPosition() + "',");
/* 1510 */       buf.append("endMachineType = '" + bo.getEndMachineType() + "' ");
/* 1511 */       buf.append(" where id = '" + bo.getId() + "'");
/* 1512 */       log.info(buf.toString());
/* 1513 */       this.dbcon.execUpdate(buf.toString());
/*      */     } catch (Exception e) {
/* 1515 */       e.printStackTrace();
/* 1516 */       flag = false;
/*      */     } finally {
/* 1518 */       dbConClose();
/*      */     }
/* 1520 */     return flag;
/*      */   }
/*      */ 
/*      */   public boolean createFiberCore(FibercoreBO bo)
/*      */   {
/* 1526 */     boolean flag = true;
/*      */     try {
/* 1528 */       dbConInit();
/* 1529 */       StringBuffer buf = new StringBuffer();
/* 1530 */       buf.append(" insert into fibercore (id,no,ocName,fiberType,testLength,usedInfo,other1,other2  ) values (");
/* 1531 */       buf.append("'" + bo.getId() + "',");
/* 1532 */       buf.append("'" + bo.getNo() + "',");
/* 1533 */       buf.append("'" + bo.getOcName() + "',");
/* 1534 */       buf.append("'" + bo.getFiberType() + "',");
/* 1535 */       buf.append("'" + bo.getTestLength() + "',");
/* 1536 */       buf.append("'" + bo.getUsedInfo() + "',");
/* 1537 */       buf.append("'" + bo.getOther1() + "',");
/* 1538 */       buf.append("'" + bo.getOther2() + "')");
/* 1539 */       log.info(buf.toString());
/* 1540 */       this.dbcon.execUpdate(buf.toString());
/*      */     } catch (Exception e) {
/* 1542 */       e.printStackTrace();
/* 1543 */       flag = false;
/*      */     } finally {
/* 1545 */       dbConClose();
/*      */     }
/* 1547 */     return flag;
/*      */   }
/*      */ 
/*      */   public boolean updateFiberCore(FibercoreBO bo) {
/* 1551 */     boolean flag = true;
/*      */     try {
/* 1553 */       dbConInit();
/* 1554 */       StringBuffer buf = new StringBuffer();
/* 1555 */       buf.append("update  fibercore set ");
/* 1556 */       buf.append("no = '" + bo.getNo() + "',");
/* 1557 */       buf.append("ocName = '" + bo.getOcName() + "',");
/* 1558 */       buf.append("fiberType = '" + bo.getFiberType() + "',");
/* 1559 */       buf.append("testLength = '" + bo.getTestLength() + "',");
/* 1560 */       buf.append("usedInfo = '" + bo.getUsedInfo() + "',");
/* 1561 */       buf.append("other1 = '" + bo.getOther1() + "',");
/* 1562 */       buf.append("other2 = '" + bo.getOther2() + "' ");
/* 1563 */       buf.append(" where id = '" + bo.getId() + "'");
/* 1564 */       log.info(buf.toString());
/* 1565 */       this.dbcon.execUpdate(buf.toString());
/*      */     } catch (Exception e) {
/* 1567 */       e.printStackTrace();
/* 1568 */       flag = false;
/*      */     } finally {
/* 1570 */       dbConClose();
/*      */     }
/* 1572 */     return flag;
/*      */   }
/*      */ 
/*      */   public boolean deleteFiberCore(String strId)
/*      */   {
/* 1577 */     boolean flag = true;
/*      */     try {
/* 1579 */       dbConInit();
/* 1580 */       String strSQL = "delete from fibercore  where id = '" + strId + 
/* 1581 */         "' ";
/* 1582 */       log.info(strSQL);
/* 1583 */       this.dbcon.execUpdate(strSQL);
/*      */     } catch (Exception e) {
/* 1585 */       flag = false;
/* 1586 */       e.printStackTrace();
/* 1587 */       log.error(e.getMessage());
/* 1588 */       log.error("delete fibercore info failure ");
/*      */     } finally {
/* 1590 */       dbConClose();
/*      */     }
/* 1592 */     return flag;
/*      */   }
/*      */ 
/*      */   public List getSectionOutInfoListByID(String strOcID, String strSelectID, int zoomNumber)
/*      */   {
/* 1597 */     log.info(" query section out info by id .");
/* 1598 */     dbConInit();
/* 1599 */     ResultSet rs = null;
/* 1600 */     List list = new ArrayList();
/*      */     try
/*      */     {
/* 1604 */       Object countObj = countMap.get(strOcID);
/* 1605 */       int intNodeCount = 0;
/* 1606 */       if ((countObj == null) || (Integer.parseInt(countObj.toString()) == 0))
/*      */       {
/* 1608 */         String strSQL = "select count(id) from sectionoutinfo where ocid = '" + 
/* 1609 */           strOcID + "'";
/*      */ 
/* 1611 */         log.info(strSQL);
/* 1612 */         rs = this.dbcon.execQuery(strSQL);
/* 1613 */         if (rs.next())
/* 1614 */           intNodeCount = rs.getInt(1);
/* 1615 */         countMap.put(strOcID, String.valueOf(intNodeCount));
/*      */       }
/*      */       String strSQL;
/* 1618 */       if (intNodeCount <= 50) {
/* 1619 */         strSQL = "select * from sectionoutinfo where ocid = '" + strOcID + "' ";
/*      */       }
/*      */       else {
/* 1622 */         strSQL = "select * from sectionoutinfo where ocid = '" + strOcID + "' and id < '" + strSelectID + "' ORDER BY outOrder LIMIT 25 " + 
/* 1623 */           " UNION ALL " + 
/* 1624 */           " select * from sectionoutinfo where ocid = '" + strOcID + "' and id > '" + strSelectID + "' ORDER BY outOrder LIMIT 25\t";
/*      */       }
/*      */ 
/* 1627 */       log.info(strSQL);
/* 1628 */       rs = this.dbcon.execQuery(strSQL);
/* 1629 */       while (rs.next()) {
/* 1630 */         SectionOutInfoBO bo = new SectionOutInfoBO();
/* 1631 */         bo.setId(rs.getString("id"));
/* 1632 */         bo.setOutOrder(rs.getInt("outOrder"));
/* 1633 */         bo.setOcid(rs.getString("ocid"));
/* 1634 */         bo.setOcName(rs.getString("ocName"));
/* 1635 */         bo.setPoleNum(rs.getString("poleNum"));
/* 1636 */         bo.setPropertyRight(rs.getString("propertyRight"));
/* 1637 */         bo.setLongleath1(rs.getString("longleath1"));
/* 1638 */         bo.setLongleath2(rs.getString("longleath2"));
/* 1639 */         bo.setLng(rs.getString("lng"));
/* 1640 */         bo.setLat(rs.getString("lat"));
/* 1641 */         bo.setDistance(rs.getString("distance"));
/* 1642 */         bo.setIsNode(rs.getString("isNode"));
/* 1643 */         bo.setIsRes(rs.getString("isRes"));
/* 1644 */         bo.setResLength(rs.getString("resLength"));
/* 1645 */         bo.setGranularity(rs.getString("granularity"));
/* 1646 */         bo.setUpdateTime(rs.getDate("updateTime"));
/* 1647 */         bo.setOcLayType(rs.getString("ocLayType"));
/* 1648 */         bo.setRouteInfo(rs.getString("routeInfo"));
/* 1649 */         list.add(bo);
/*      */       }
/*      */     } catch (Exception e) {
/* 1652 */       e.printStackTrace();
/* 1653 */       log.error("query fiber section failed .");
/*      */     } finally {
/* 1655 */       dbConClose();
/*      */     }
/* 1657 */     return list;
/*      */   }
/*      */ 
/*      */   public List getSectionOutInfoListByInputValue(String strOcName)
/*      */   {
/* 1662 */     List list = new ArrayList();
/* 1663 */     ResultSet rs = null;
/*      */     try {
/* 1665 */       dbConInit();
/* 1666 */       StringBuffer buf = new StringBuffer();
/* 1667 */       buf.append("select distinct OcID,OcName from sectionoutinfo ");
/* 1668 */       buf.append("where binary ucase(OcName) like concat('%',ucase('" + 
/* 1669 */         strOcName + "'),'%') ");
/*      */ 
/* 1672 */       log.info(buf.toString());
/* 1673 */       rs = this.dbcon.execQuery(buf.toString());
/* 1674 */       while (rs.next()) {
/* 1675 */         SectionOutInfoBO bo = new SectionOutInfoBO();
/* 1676 */         bo.setOcid(rs.getString("OcID"));
/* 1677 */         bo.setOcName(rs.getString("OcName"));
/* 1678 */         list.add(bo);
/*      */       }
/*      */     } catch (Exception e) {
/* 1681 */       e.printStackTrace();
/* 1682 */       log.error("query fiber section failed .");
/*      */     } finally {
/* 1684 */       dbConClose();
/*      */     }
/* 1686 */     return list;
/*      */   }
/*      */ 
/*      */   public List getSectionOutInfoListByInputValue(String strOcName, String strDistance)
/*      */   {
/* 1692 */     List list = new ArrayList();
/* 1693 */     ResultSet rs = null;
/*      */     try {
/* 1695 */       dbConInit();
/* 1696 */       StringBuffer buf = new StringBuffer();
/* 1697 */       buf.append("select id,OcID,OcName from sectionoutinfo ");
/* 1698 */       buf.append("where binary ucase(OcName) like concat('%',ucase('" + 
/* 1699 */         strOcName + "'),'%') ");
/* 1700 */       buf.append("order by abs(granularity- '" + strDistance + 
/* 1701 */         "') limit 0,1 ");
/*      */ 
/* 1704 */       log.info(buf.toString());
/* 1705 */       rs = this.dbcon.execQuery(buf.toString());
/* 1706 */       while (rs.next()) {
/* 1707 */         SectionOutInfoBO bo = new SectionOutInfoBO();
/* 1708 */         log.info("***id = [" + rs.getString("id") + "]*");
/* 1709 */         bo.setId(rs.getString("id"));
/* 1710 */         bo.setOcid(rs.getString("OcID"));
/* 1711 */         bo.setOcName(rs.getString("OcName"));
/* 1712 */         list.add(bo);
/*      */       }
/*      */     } catch (Exception e) {
/* 1715 */       e.printStackTrace();
/* 1716 */       log.error("query fiber section failed .");
/*      */     } finally {
/* 1718 */       dbConClose();
/*      */     }
/* 1720 */     return list;
/*      */   }
/*      */ 
/*      */   public boolean DeleteFiberUsedInfo(String strId) {
/* 1724 */     boolean flag = true;
/*      */     try {
/* 1726 */       dbConInit();
/* 1727 */       String strSQL = "delete from fiberusedinfo where id = '" + strId + 
/* 1728 */         "' ";
/* 1729 */       log.info(strSQL);
/* 1730 */       this.dbcon.execUpdate(strSQL);
/*      */     } catch (Exception e) {
/* 1732 */       flag = false;
/* 1733 */       e.printStackTrace();
/* 1734 */       log.error(e.getMessage());
/* 1735 */       log.error("delete fiberusedinfo failure ");
/*      */     } finally {
/* 1737 */       dbConClose();
/*      */     }
/* 1739 */     return flag;
/*      */   }
/*      */ 
/*      */   public boolean isFiberUsed(String fiberid) {
/* 1743 */     boolean flag = false;
/*      */     try {
/* 1745 */       ResultSet rs = null;
/* 1746 */       dbConInit();
/* 1747 */       String strSQL = "select id from fiberusedinfo where fiberid = '" + fiberid + 
/* 1748 */         "' ";
/* 1749 */       log.info(strSQL);
/* 1750 */       rs = this.dbcon.execQuery(strSQL);
/* 1751 */       if (rs.next())
/* 1752 */         flag = true;
/*      */     } catch (Exception e) {
/* 1754 */       flag = false;
/* 1755 */       e.printStackTrace();
/* 1756 */       log.error(e.getMessage());
/*      */     } finally {
/* 1758 */       dbConClose();
/*      */     }
/* 1760 */     return flag;
/*      */   }
/*      */ 
/*      */   public boolean isSectionHaveFiber(String strID) {
/* 1764 */     boolean flag = false;
/* 1765 */     boolean fiberFlag = false;
/*      */     try {
/* 1767 */       ResultSet rs = null;
/* 1768 */       ResultSet rsFiber = null;
/* 1769 */       dbConInit();
/* 1770 */       String strSQL = "select ocid from sectionoutinfo where ocid = '" + strID + "' ";
/* 1771 */       log.info(strSQL);
/* 1772 */       rs = this.dbcon.execQuery(strSQL);
/* 1773 */       if (rs.next())
/* 1774 */         flag = true;
/* 1775 */       strSQL = "select ocid from fiberinfo where ocid = '" + strID + "' ";
/* 1776 */       log.info(strSQL);
/* 1777 */       rsFiber = this.dbcon.execQuery(strSQL);
/* 1778 */       if (rsFiber.next())
/* 1779 */         fiberFlag = true;
/*      */     }
/*      */     catch (Exception e) {
/* 1782 */       flag = false;
/* 1783 */       e.printStackTrace();
/* 1784 */       log.error(e.getMessage());
/*      */     } finally {
/* 1786 */       dbConClose();
/*      */     }
/* 1788 */     return (flag) || (fiberFlag);
/*      */   }
/*      */ 
/*      */   public boolean isUsedByLink(String strID)
/*      */   {
/* 1793 */     boolean flag = false;
/*      */     try {
/* 1795 */       ResultSet rs = null;
/* 1796 */       dbConInit();
/* 1797 */       String strSQL = "select linkID from fiberlinkandsection where ocid = '" + strID + "' ";
/* 1798 */       log.info(strSQL);
/* 1799 */       rs = this.dbcon.execQuery(strSQL);
/* 1800 */       if (rs.next())
/* 1801 */         flag = true;
/*      */     }
/*      */     catch (Exception e) {
/* 1804 */       flag = false;
/* 1805 */       e.printStackTrace();
/* 1806 */       log.error(e.getMessage());
/*      */     } finally {
/* 1808 */       dbConClose();
/*      */     }
/* 1810 */     return flag;
/*      */   }
/*      */ 
/*      */   public boolean isLinkHaveSection(String strLinkId)
/*      */   {
/* 1816 */     boolean flag = false;
/*      */     try {
/* 1818 */       dbConInit();
/* 1819 */       ResultSet rs = null;
/* 1820 */       String strSQL = "select OcID from sectiontotalinfo where linkID = '" + strLinkId + "' ";
/* 1821 */       log.info(strSQL);
/* 1822 */       rs = this.dbcon.execQuery(strSQL);
/* 1823 */       if (rs.next())
/* 1824 */         flag = true;
/*      */     } catch (Exception e) {
/* 1826 */       flag = false;
/* 1827 */       e.printStackTrace();
/* 1828 */       log.error(e.getMessage());
/*      */     } finally {
/* 1830 */       dbConClose();
/*      */     }
/* 1832 */     return flag;
/*      */   }
/*      */ 
/*      */   public boolean testDeleteSectionOutInfo(String strId)
/*      */   {
/* 1837 */     boolean flag = true;
/*      */     try {
/* 1839 */       dbConInit();
/* 1840 */       String strSQL = "delete from sectionoutinfo  where ocid = '" + 
/* 1841 */         strId + "' ";
/* 1842 */       log.info(strSQL);
/* 1843 */       this.dbcon.execUpdate(strSQL);
/*      */     } catch (Exception e) {
/* 1845 */       flag = false;
/* 1846 */       e.printStackTrace();
/* 1847 */       log.error(e.getMessage());
/* 1848 */       log.error("delete section out info failure ");
/*      */     } finally {
/* 1850 */       dbConClose();
/*      */     }
/* 1852 */     return flag;
/*      */   }
/*      */ }

/* Location:           E:\java\apache-tomcat-6.0.36\webapps\btsm\WEB-INF\classes\
 * Qualified Name:     com.yc.dao.FiberDAO
 * JD-Core Version:    0.6.2
 */